using ZR.Model.Enums;

namespace ZR.Model.BaseFrame.Dto
{
    /// <summary>
    /// 模块表单对象
    /// </summary>
    public class ModuleFormDtoBase
    {      
        /// <summary>
        /// 模块标识
        /// </summary>
        [Required(ErrorMessage = "模块标识不能为空")]
        public long ModuleId { get; set; }
        
        /// <summary>
        /// 上级模块
        /// </summary>
        [Required(ErrorMessage = "上级模块不能为空")]
        public long PaModuleId { get; set; }
        
        /// <summary>
        /// 模块名称
        /// </summary>
        [Required(ErrorMessage = "模块名称不能为空")]
        public string ModuleName { get; set; }
        
        /// <summary>
        /// 模块代码
        /// </summary>
        [Required(ErrorMessage = "模块代码不能为空")]
        public string ModuleCode { get; set; }
        
        /// <summary>
        /// 菜单类型
        /// </summary>
        [Required(ErrorMessage = "菜单类型不能为空")]
        public string MenuTypeCode { get; set; }
        
        /// <summary>
        /// 页面路径
        /// </summary>
        public string PagePath { get; set; }
        
        /// <summary>
        /// 链接路径
        /// </summary>
        public string LinkPath { get; set; }
        
        /// <summary>
        /// 排序编号
        /// </summary>
        [Required(ErrorMessage = "排序编号不能为空")]
        public decimal SortNo { get; set; }
        
        /// <summary>
        /// 是否显示
        /// </summary>
        public bool IsVisible { get; set; }
        
        /// <summary>
        /// 状态
        /// </summary>
        [Required(ErrorMessage = "状态不能为空")]
        public string StateCode { get; set; }
        
        /// <summary>
        /// 图标
        /// </summary>
        [Required(ErrorMessage = "图标不能为空")]
        public string Icon { get; set; }
        
        /// <summary>
        /// 描述
        /// </summary>
        public string Desc { get; set; }
        

    }

    /// <summary>
    /// 删除模块请求对象
    /// </summary>
    public class DeleteModuleReqBase
    {
        /// <summary>
        /// 标识集合
        /// </summary>
        public string Ids { get; set; }
    }

    /// <summary>
    /// 变更模块状态请求对象
    /// </summary>
    public class ChangeModuleStateReqBase
    {
        /// <summary>
        /// 标识
        /// </summary>
        public long Id { get; set; }
        
        /// <summary>
        /// 状态编码
        /// </summary>
        public string StateCode { get; set; }
        
        /// <summary>
        /// 状态枚举
        /// </summary>
        [JsonIgnore]
        public DataStateEnum? StateEnum
        {
            get
            {
                DataStateEnum stateEnum;
                var isOk = Enum.TryParse(StateCode, true, out stateEnum);
                if (isOk && Enum.IsDefined(stateEnum))
                {
                    return stateEnum;
                }
                return null;
            }
        }
    }

    /// <summary>
    /// 获取模块树选择列表请求对象
    /// </summary>
    public class GetModuleTreeSelectListReqBase:GetTreeSelectListReqBase
    {
    }

    /// <summary>
    /// 获取模块分页列表请求对象
    /// </summary>
    public class GetModulePageListReqBase : PagerInfo 
    {
        /// <summary>
        /// 树结点标识
        /// </summary>
        public long? TreeNodeId { get; set; }
        /// <summary>
        /// 是否是默认结点类型
        /// </summary>
        public bool IsDefaultNodeType { get; set; }=true;

        /// <summary>
        /// 关键词
        /// </summary>
        public string Keywords { get; set; }

        /// <summary>
        /// 菜单类型
        /// </summary>
        public string MenuTypeCode { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public string StateCode { get; set; }


    }

    /// <summary>
    /// 模块列表项
    /// </summary>
    public class ModuleListItemDtoBase
    {
        /// <summary>
        /// 模块标识
        /// </summary>
        public long ModuleId { get; set; }
        
        /// <summary>
        /// 上级模块
        /// </summary>
        public long PaModuleId { get; set; }
        
        public string PaModuleName { get; set; }
        /// <summary>
        /// 模块名称
        /// </summary>
        public string ModuleName { get; set; }
        
        /// <summary>
        /// 模块代码
        /// </summary>
        public string ModuleCode { get; set; }
        
        /// <summary>
        /// 菜单类型
        /// </summary>
        public string MenuTypeCode { get; set; }
        
        /// <summary>
        /// 页面路径
        /// </summary>
        public string PagePath { get; set; }
        
        /// <summary>
        /// 链接路径
        /// </summary>
        public string LinkPath { get; set; }
        
        /// <summary>
        /// 排序编号
        /// </summary>
        public decimal SortNo { get; set; }
        
        /// <summary>
        /// 是否显示
        /// </summary>
        public bool IsVisible { get; set; }
        
        /// <summary>
        /// 状态
        /// </summary>
        public string StateCode { get; set; }
        
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }
        
        /// <summary>
        /// 创建人
        /// </summary>
        public string Creater { get; set; }
        
    }

    /// <summary>
    /// 模块详情
    /// </summary>
    public class ModuleDetailDtoBase: ModuleFormDto
    {

    }
}